<?php
namespace app\common\lib;

class Pdf extends \TCPDF
{
    /**
     * 图片类型
     * @var string
     */
    public  $extension = 'jpg';
    /**
     * logo 宽高
     * @var int
     */
    public  $logo = '';
    public  $LogoWidth = 30;
    public  $LogoHeight= 15;
    public  $logoLink = '';
    /**
     * 定位属性
     * @var int
     */
    public  $xAxis=10;
    public  $yAxis=10;


    public function set_logo($imgFile,$width=30,$height=15,$postion=[],$logoLink='')
    {
        $parseFile = pathinfo($imgFile);
        if(isset($parseFile['extension'])) $this->extension = $parseFile['extension'];
        $this->LogoWidth  = $width;
        $this->LogoHeight = $height;
        $this->logo = $imgFile;
        if(isset($postion['xAxis'])) $this->xAxis=$postion['xAxis'];
        if(isset($postion['yAxis'])) $this->xAxis=$postion['yAxis'];
        if(!empty($postion['$logoLink'])) $this->logoLink=$logoLink;
    }


    /*public function Header()
    {
        $this->Image($this->logo,$this->xAxis, $this->yAxis, $this->LogoWidth, $this->LogoHeight, $this->extension, $this->logoLink, 'T', false, 300, '', false, false, 1, false, false, false);
        $this->Cell(0, 30, $this->title, 1, true, 'C', 0, '', 0, false, 'M', 'M');
    }

    public function Footer()
    {
        $this->SetY(-15);
        $this->SetFont('stsongstdlight', 'I', 8);
        $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
    }*/
}